<template>
	<view class="SearchPage">
		<view class="SearchPageBox">
			<view class="top_nav_wrap">
				<view class="status_bar">
					<!-- 这里是状态栏 -->
				</view>
				<view class="searchBox" :style="{'padding-right':menuWidth>0?menuWidth+'px':''}">
					<view @click="goBack">
						<u-icon name="arrow-left" color="#515151" size="40"></u-icon>
					</view>
					<view class="inputBox">
						<u-icon name="search" color="#999" size="32"></u-icon>
						<input type="text" placeholder="请输入搜索内容" v-model="keyword" :focus="true" confirm-type="search"
							@confirm="searchBtn" />
						<view class="closeBox" @click="emptyBtn" v-if="keyword">
							<u-icon name="close" size="10" color="#fff"></u-icon>
						</view>
					</view>
					<view class="searchName" @click="searchBtn">搜索</view>
				</view>
				<view class="navHead">
					<view :class="['navItem',navIndex==0?'active':'']" data-index="0" @click="changeNav">
						商品
					</view>
					<view :class="['navItem',navIndex==1?'active':'']" data-index="1" @click="changeNav">
						测评
					</view>
					<view :class="['navItem',navIndex==2?'active':'']" data-index="2" @click="changeNav">
						内容
					</view>
					<view :class="['navItem',navIndex==3?'active':'']" data-index="3" @click="changeNav">
						门店
					</view>
					<view :class="['navItem',navIndex==4?'active':'']" data-index="4" @click="changeNav">
						用户
					</view>
				</view>
			</view>
			<view class="status_bar">
				<!-- 这里是状态栏 -->
			</view>
			<!-- <view class="historyBox" v-if="contentList.length==0 && historyList.length>0">
				<view class="historytitle">
					<view class="historyName">历史搜索</view>
					<view @click="emptyhistory">
						<u-icon name="trash" size="40" color="#BFBFBF"></u-icon>
					</view>
				</view>
				<view class="historyList">
					<view class="historyItem" v-for="(item,index) in historyList">{{item.title}}</view>
				</view>
			</view> -->

			<view class="contentListWrap" v-if="conList.length>0&&navIndex==1">
				<view class="contentList">
					<view class="contentItem" v-for="(item,index) in conList" :key="index" :data-id="item.id"
						@click="toActivityDetails">
						<view class="contentItem_top">
							<view class="contentImage"
								:style="{'background-image':'url('+getImage(item.ShopEvaluationExampleImage[0])+')'}"
								v-if="item.ShopEvaluationExampleImage.length>0">
								<!-- <image :src="getImgUrl(item.ShopEvaluationExampleImage[0].image_url)" mode="" v-if="item.ShopEvaluationExampleImage.length>0"></image> -->
							</view>
							<view class="content_R">
								<view class="contentNameBox">
									<view class="contentItemName">{{item.title}}</view>
									<view class="Royalties">稿费￥{{item.talent_money}}</view>
								</view>
								<view class="addressBox">
									<view class="fieldBox">
										<view class="recommendtitle fieldtitle">领域</view>
										<view class="fieldtext">{{item.industry_name}}</view>
									</view>

									<view class="addressNum">
										<view class="address">{{item.shop_name}}</view>
										<view class="addressR">{{item.juli}}km</view>

									</view>

								</view>
								<view class="fansBox">
									<view class="fansIcon" v-if="item.platform==1">
										<image src="../../static/index/fans.png" mode=""></image>
									</view>
									<view class="fansIcon" v-if="item.platform==2" style="background: #F40A0B;">
										<image src="../../static/mine/xiaohongshu_white.png" mode="widthFix"
											style="width: 36upx;"></image>
									</view>
									<view class="fansIcon" v-if="item.platform==3" style="background: #FFD974;">
										<image src="../../static/mine/weibo_white.png" mode="widthFix"
											style="width: 20upx;"></image>
									</view>
									<view class="fansIcon" v-if="item.platform==4" style="background: #F36326;">
										<image src="../../static/mine/dazong_white.png" mode="heightFix"
											style="height: 24upx;"></image>
									</view>

									<view class="fanstext"><text>粉丝数{{item.fans_num}}以上</text><text
											v-if="item.platform==4">;等级{{item.public_grade}}以上</text></view>
								</view>
								<view class="recommendBox">
									<view class="recommendtitle">内容</view>
									<view class="recommendtext">{{item.content}}</view>
								</view>

							</view>
						</view>
						<view class="contentItem_B">
							<view class="surplus">
								<!-- #ifdef APP -->
								分享达人可赚取<text>{{item.user_commission_money}}</text>元
								<!-- #endif -->
							</view>
							<view class="surplusNum">仅剩:<span style="color: #FF5555;">{{item.num}}</span>份</view>
						</view>
					</view>
				</view>
			</view>
			<view class="ProductBox" v-if="conList.length>0&&navIndex==3">
				<view class="ProductItem" v-for="(item,index) in conList" :key="index" @click="toFoodDetails"
					:data-id="item.id" v-if="navIndex==3">
					<view class="ItemTop">
						<view class="ProductImage" :style="{'background-image':'url('+getImage(item.image_url)+')'}">
							<!-- <image :src="getImage(item.image_url)" mode=""></image> -->
						</view>
						<view class="ProductInfo">
							<view class="ProductNameBox">
								<view class="ProductName">{{item.name}}</view>
								<view class="sales-volume">售{{item.sales_volume_sum}}</view>
							</view>
							<view class="addressBox">
								<view class="address">{{item.industry_name}}</view>
								<view class="addressNum">{{item.juli}}km</view>
							</view>
							<!-- <view class="ranking">番禺区西式快餐第1名</view>. -->
							<!-- <view class="evaluateBox">
								<view class="evaluateItem" v-for="(item,index) in 2">“太好吃了！”</view>
							</view> -->
						</view>
					</view>
					<!-- <view class="ItemBottom" v-if="item.ShopPackageRelation.length>0">
						<view class="couponBox" v-for="(pitem,pindex) in item.ShopPackageRelation" :key="pindex"
							v-if="pindex<2&&pitem.ShopPackage">
							<view class="couponIcon">惠</view>
							<view class="couponPrice">{{pitem.ShopPackage?pitem.ShopPackage.money:0}}元</view>
							<view class="coupontext">{{pitem.ShopPackage?pitem.ShopPackage.name:"无"}}</view>
						</view>
					</view> -->
				</view>


			</view>
			<view class="ProductBox" v-if="conList.length>0&&navIndex==0">
				<view class="DiscountItem" v-for="(item,index) in conList" :key="index" @click="toOfferDetails"
					v-if="navIndex==0" :data-id="item.id">
					<view class="Item_top">
						<view class="ItemImage" :style="{'background-image':'url('+getImage(item.title_image)+')'}">
							<!-- <image :src="getImage(item.title_image)" mode=""></image> -->
						</view>
						<view class="Iteminfo">
							<view class="info_top">
								<view class="NameBox">
									<view class="Name">{{item.name}}</view>
									<!-- <view class="titmes">周一至周日|免预约</view> -->
								</view>
								<view class="buyBox" v-if="item.num>0||item.stock_num==0">抢购</view>
								<view class="buyBox" style="background: #BBBBBB;color:#fff" v-else>售罄</view>

							</view>
							<view class="priceBox">
								<view class="price">￥{{item.money}}<text
										style="margin-left: 8upx;text-decoration: line-through;color:#999;font-size: 16upx;">￥{{item.oldMoney}}</text>
								</view>
								<view class="volume">售{{item.sales_volume}}</view>
							</view>
						</view>
					</view>
					<view class="Item_bottom">
						<view class="share">
							<!-- #ifdef APP -->
							分享用户可赚取{{item.user_commission_money}}元；
							<!-- #endif -->
						</view>
						<view class="surplus" v-if="item.stock_num==0">不限量</view>
						<view class="surplus" v-else>仅剩:<text style="color:#FF5555">{{item.num}}</text>份</view>
					</view>
				</view>

			</view>
			
			<view class="foodBox" v-if="conList.length>0&&navIndex==2">
				<u-waterfall v-model="conList" ref="uWaterfall">
					<template v-slot:left="{leftList}">
						<view class="foodItem" @click="toFindDetail" v-for="(item, index) in leftList" :key="index"
							:data-id="item.id" :data-type="item.imgType">
							<view class="foodImage" v-if="!item.imgType&&item.titleImage">
								<image :src="item.titleImage" mode="widthFix" style="width: 100%;"></image>
								<view class="playIcon">
									<u-icon name="play-circle-fill" size="48"></u-icon>
								</view>
							</view>
							<view class="foodImage" v-if="item.imgType&&item.titleImage">
								<image :src="item.titleImage" mode="widthFix" style="width: 100%;"></image>
							</view>
							<view class="foodName">{{item.title}}</view>
							<view class="food_B">
								<view class="userInfo">
									<view class="userImage">
										<image :src="item.userImg" mode=""></image>
									</view>
									<view class="userName">{{item.username}}</view>
								</view>
								<view class="giveBox">
									<view v-if="!item.UserShareCollection">
										<u-icon name="heart-fill" color="#999"></u-icon>
									</view>
									<view v-else>
										<u-icon name="heart-fill" color="#FF5555"></u-icon>
									</view>
									<view class="giveNum">{{item.collect_num}}</view>
								</view>
							</view>
						</view>
					</template>
					<template v-slot:right="{rightList}">
						<view class="foodItem" @click="toFindDetail" v-for="(item, index) in rightList" :key="index"
							:data-id="item.id" :data-type="item.imgType">
							<view class="foodImage" v-if="!item.imgType&&item.titleImage">
								<image :src="item.titleImage" mode="widthFix" style="width: 100%;"></image>
								<view class="playIcon">
									<u-icon name="play-circle-fill" size="48"></u-icon>
								</view>
							</view>
							<view class="foodImage" v-if="item.imgType&&item.titleImage">
								<image :src="item.titleImage" mode="widthFix" style="width: 100%;"></image>
							</view>
							<view class="foodName">{{item.title}}</view>
							<view class="food_B">
								<view class="userInfo">
									<view class="userImage">
										<image :src="item.userImg" mode=""></image>
									</view>
									<view class="userName">{{item.username}}</view>
								</view>
								<view class="giveBox">
									<view v-if="!item.UserShareCollection">
										<u-icon name="heart-fill" color="#999"></u-icon>
									</view>
									<view v-else>
										<u-icon name="heart-fill" color="#FF5555"></u-icon>
									</view>
									<view class="giveNum">{{item.collect_num}}</view>
								</view>
							</view>
						</view>
					</template>
				</u-waterfall>
			</view>
			<view class="userWrap" v-if="conList.length>0&&navIndex==4">
				<view class="userItem" v-for="(item,index) in conList" :key="index" :data-id="item.id" @click="toUsers">
					<!-- <image :src="getImage(item.image_url)"></image> -->
					<view class="imgAvator" :style="{'background-image':'url('+getImage(item.image_url)+')'}"></view>
					<view class="userItemR">
						<view class="userItemRT">
							<view class="userItemRTL">
								<view>{{item.username}}</view>
								<image src="../../static/share/man.png" mode="heightFix" v-if="item.gender==1"></image>
								<image src="../../static/share/woman.png" mode="heightFix" v-if="item.gender==2">
								</image>
							</view>
							<view class="userItemRTR">
								发布{{item.share_count?item.share_count:0}} | 获赞{{item.collect_num?item.collect_num:0}}
							</view>
						</view>
						<view class="userItemRB">
							<view class="userItemRBL" v-for="(pitem,pindex) in item.UserBusinessAreas" :key="pindex">
								<image src="../../static/mine/quyu.png" mode="heightFix"></image>
								<view>
									{{pitem.BusinessAreas.name}}<text>({{pitem.distance}}km)</text>
								</view>
							</view>
							<!-- <view class="userItemRBL">
								<image src="../../static/mine/quyu.png" mode="heightFix"></image>
								<view>
									花城汇<text>(2.5km)</text>
								</view>
							</view> -->
						</view>
					</view>
				</view>
			</view>
			<view class="emptyBox" v-if="conList.length==0">
				<u-empty text="搜索不到T T" mode="search" icon-size="200"></u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				searchValue:"",//搜索框
				historyList:[],//历史记录列表
				conList:[],//数据列表
				menuWidth:0,
				navIndex:0,
				page:1,
				moreFlag:false,
				keyword:""
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
			//微信小程序胶囊按钮信息
			let res = uni.getMenuButtonBoundingClientRect();
			let { windowWidth, windowHeight } = uni.getSystemInfoSync();
			
			this.menuWidth = res.width + (windowWidth - res.right) + 10;
			// #endif
			if(app.$vm.globalData.latitude){
				this.getList();
			}else{
				app.$vm.indexInitFun().then(res=>{
					this.getList();
				})
			}
		},
		onReachBottom() {
			if(!this.moreFlag){
				return false;
			}
			this.moreFlag = false;
			this.page = this.page + 1;
			if(this.navIndex==0){
				this.getList();
			}else if(this.navIndex==1){
				this.getCpList();
			}else if(this.navIndex==2){
				this.getConList();
			}else if(this.navIndex==3){
				this.getList();
			}else if(this.navIndex==4){
				this.getUser();
			}
		},
		onLoad() {
			this.getList();
		},
		methods: {
			toUsers(e){
				let id = e.target.dataset.id || e.currentTarget.dataset.id;
				uni.navigateTo({
					url:"/pages/pageone/pages/Business-card/Business-card?id="+id
				})
			},
			getVideoUrl(url) {
				return app.$vm.globalData.imgBaseUrl + url + app.$vm.globalData.videoThumb;
			},
			toFindDetail(e) {
				let id = e.target.dataset.id || e.currentTarget.dataset.id;
				let type = e.target.dataset.type || e.currentTarget.dataset.type;
				if (type) {
					uni.navigateTo({
						url: "/pages/pagetwo/pages/FindDetail/FindDetail?id=" + id
					})
				} else {
					uni.navigateTo({
						url: "/pages/pagefive/pages/VideoDetail/VideoDetail?id=" + id
					})
				}
			},
			getConList() {
				let obj = {};
				obj.page = this.page;
				obj.juli = 1;
				
				// obj.data.lat = app.$vm.globalData.latitude;
				// obj.data.lng = app.$vm.globalData.longitude;
				obj.lng = uni.getStorageSync("longitude");//117.082094;
				obj.lat = uni.getStorageSync("latitude");//39.987725;
				if(this.keyword.trim()){
					obj.labelScreen = this.keyword;
				}
				if (uni.getStorageSync("rmToken")) {
					this.$u.api.shareList(obj).then(res => {
						
						if (this.page == 1) {
							this.conList = [];
							// this.$forceUpdate();
							setTimeout(()=>{
								for (let i = 0; i < res.data.length; i++) {
									let cur = res.data[i];
									if(cur.shareimgss.length>0){
										if (app.$vm.isImage(cur.shareimgss[0])) {
											cur.titleImage = this.getImage(cur.shareimgss[0]);
											cur.imgType = true;
										} else {
											cur.titleImage = this.getVideoUrl(cur.shareimgss[0]);
											cur.imgType = false;
										}
									}else{
										cur.imgType = true;
									}
									cur.userImg = this.getImage(cur.image_url);
									if(i<this.conList.length){
										this.conList.splice(i,1,cur)
									}else{
										this.conList.push(cur)
									}
									
								}
								this.$forceUpdate();
							},300)
							
						} else {
							for (let i = 0; i < res.data.length; i++) {
								let cur = res.data[i];
								if(cur.shareimgss.length>0){
									if (app.$vm.isImage(cur.shareimgss[0])) {
										cur.titleImage = this.getImage(cur.shareimgss[0]);
										cur.imgType = true;
									} else {
										cur.titleImage = this.getVideoUrl(cur.shareimgss[0]);
										cur.imgType = false;
									}
								}else{
									cur.imgType = true;
								}
								cur.userImg = this.getImage(cur.image_url);
								this.conList.push(cur)
							}
							this.$forceUpdate();
						}
						if(this.page<res.data.last_page){
							this.moreFlag = true;
						}else{
							this.moreFlag = false;
						}
					})
				} else {
					this.$u.api.indexShareList(obj).then(res => {
						if (this.page == 1) {
							this.conList = [];
							setTimeout(()=>{
								for (let i = 0; i < res.data.length; i++) {
									let cur = res.data[i];
									if(cur.shareimgss.length>0){
										if (app.$vm.isImage(cur.shareimgss[0])) {
											cur.titleImage = this.getImage(cur.shareimgss[0]);
											cur.imgType = true;
										} else {
											cur.titleImage = this.getVideoUrl(cur.shareimgss[0]);
											cur.imgType = false;
										}
									}else{
										cur.imgType = true;
									}
									cur.userImg = this.getImage(cur.image_url);
									if(i<this.conList.length){
										this.conList.splice(i,1,cur)
									}else{
										this.conList.push(cur)
									}
									
								}
								this.$forceUpdate();
							},300)
							this.$forceUpdate();
						} else {
							for (let i = 0; i < res.data.length; i++) {
								let cur = res.data[i];
								if(cur.shareimgss.length>0){
									if (app.$vm.isImage(cur.shareimgss[0])) {
										cur.titleImage = this.getImage(cur.shareimgss[0]);
										cur.imgType = true;
									} else {
										cur.titleImage = this.getVideoUrl(cur.shareimgss[0]);
										cur.imgType = false;
									}
								}else{
									cur.imgType = true;
								}
								cur.userImg = this.getImage(cur.image_url);
								this.conList.push(cur)
							}
							this.$forceUpdate();
						}
						if(this.page<res.data.last_page){
							this.moreFlag = true;
						}else{
							this.moreFlag = false;
						}
					})
				}
			},
			toOfferDetails(e){
				let id = e.target.dataset.id || e.currentTarget.dataset.id;
				uni.navigateTo({
					url:"/pages/pagethree/pages/OfferDetails/OfferDetails?id="+id
				})
			},
			toFoodDetails(e){
				let id = e.target.dataset.id || e.currentTarget.dataset.id;
				uni.navigateTo({
					url:"/pages/pagetwo/pages/FoodDetails/FoodDetails?id="+id
				})
			},
			getImage(url){
				if(url&&(url.indexOf("http://")!=-1||url.indexOf("https://")!=-1)){
					return url;
				}else{
					return app.$vm.globalData.imgBaseUrl + url;
				}
			},
			changeNav(e){
				let index = e.target.dataset.index || e.currentTarget.dataset.index;
				this.navIndex = index;
				this.page = 1;
				this.conList = [];
				if(index==0){
					this.getList();
				}else if(index==1){
					this.getCpList();
				}else if(index==2){
					this.getConList();
				}else if(index==3){
					this.getList();
				}else if(index==4){
					this.getUser();
				}
			},
			getUser(){
				let obj = {};
				obj.page = this.page;
				if(this.keyword.trim()){
					//obj.data = {};
					obj.search = this.keyword;
					obj.longitude = app.$vm.globalData.longitude;
					obj.dimension = app.$vm.globalData.latitude;
				}
				this.$u.api.userList(obj).then(res=>{
					
					if(this.page == 1){
						this.conList = res.data.map(cur=>{
							
							if(cur.UserBusinessAreas&&cur.UserBusinessAreas.length>0){
								cur.UserBusinessAreas = cur.UserBusinessAreas.map(pcur=>{
									
									pcur.distance = app.$vm.getDistance(Number(pcur.dimension),Number(pcur.longitude));
									return pcur;
								})
							}else{
								cur.UserBusinessAreas = [];
							}
							return cur;
						})
					}else{
						this.conList = this.conList.concat(res.data.list.map(cur=>{
							
							if(cur.UserBusinessAreas&&cur.UserBusinessAreas.length>0){
								cur.UserBusinessAreas = cur.UserBusinessAreas.map(pcur=>{
									
									pcur.distance = app.$vm.getDistance(Number(pcur.dimension),Number(pcur.longitude));
									return pcur;
								})
							}else{
								cur.UserBusinessAreas = [];
							}
							return cur;
						}))
					}
				})
			},
			toActivityDetails(e){
				let id = e.target.dataset.id || e.currentTarget.dataset.id;
				uni.navigateTo({
					url:"/pages/pageone/pages/ActivityDetails/ActivityDetails?id="+id
				})
			},
			getList(){
				if(this.navIndex==3){
					let obj = {};
					// obj.lng = app.$vm.globalData.longitude;
					// obj.lat = app.$vm.globalData.latitude;
					obj.lng = uni.getStorageSync("longitude");//117.082094;
					obj.lat = uni.getStorageSync("latitude");//39.987725;
					obj.juli = 1;
					if(this.keyword.trim()){
						obj.search = this.keyword;
					}
					obj.page = this.page;
					this.$u.api.shopList(obj).then(res=>{
						
						if(this.page==1){
							this.conList = res.data.map(cur=>{
								cur.juli = (Math.round(cur.juli*100)/100).toFixed(2);
								return cur;
							});
						}else{
							this.conList = this.conList.concat(res.data.map(cur=>{
								cur.juli = (Math.round(cur.juli*100)/100).toFixed(2);
								return cur;
							}));
						}
						if(this.page<res.data.last_page){
							this.moreFlag = true;
						}else{
							this.moreFlag = false;
						}
					})
				}else{
					let obj = {};
					obj.juli = 1;
					
					
					obj.lng = uni.getStorageSync("longitude");//117.082094;
					obj.lat = uni.getStorageSync("latitude");//39.987725;
					
					
					if(this.keyword.trim()){
						obj.search = this.keyword;
					}
					obj.page = this.page;
					
					this.$u.api.shopPackageGetList(obj).then(res=>{
						
						if(this.page==1){
							this.conList = res.data.map(cur=>{
								cur.limit_time = cur.limit_time;
								if(cur.package_title){
									let arr = cur.package_title;
									let pArr = [];
									for(let i=0;i<arr.length;i++){
										let price = 0;
										if(arr[i].conList){
											for(let j=0;j<arr[i].conList.length;j++){
												price = price + Number(arr[i].conList[j].price);
											}
										}
										pArr.push(price);
									}
									let money = pArr.length>0?pArr[0]:0;
									for(let i=0;i<pArr.length;i++){
										if(money<pArr[i]){
											money = pArr[i];
										}
									}
									cur.oldMoney = money;
								}else{
									cur.oldMoney = 0;
								}
								return cur;
							});
						}else{
							this.conList = this.conList.concat(res.data.map(cur=>{
								cur.limit_time = cur.limit_time;
								
								if(cur.package_title){
									let arr = cur.package_title;
									let pArr = [];
									for(let i=0;i<arr.length;i++){
										let price = 0;
										if(arr[i].conList){
											for(let j=0;j<arr[i].conList.length;j++){
												price = price + Number(arr[i].conList[j].price);
											}
										}
										pArr.push(price);
									}
									let money = pArr.length>0?pArr[0]:0;
									for(let i=0;i<pArr.length;i++){
										if(money<pArr[i]){
											money = pArr[i];
										}
									}
									cur.oldMoney = money;
								}else{
									cur.oldMoney = 0;
								}
								return cur;
							}));
						}
						if(this.page<res.data.last_page){
							this.moreFlag = true;
						}else{
							this.moreFlag = false;
						}
					})
				}
			},
			getCpList(){
				let obj = {};
				obj.juli = 1;
				// obj.lng = app.$vm.globalData.longitude;
				// obj.lat = app.$vm.globalData.latitude;
				obj.lng = uni.getStorageSync("longitude");//117.082094;
				obj.lat = uni.getStorageSync("latitude");//39.987725;
				if(this.keyword.trim()){
					obj.screen = this.keyword;
				}
				
				obj.page = this.page;
				this.$u.api.shopEvaluationListNoLogin(obj).then(res=>{
					
					if(this.page==1){
						this.conList = res.data.map(cur=>{
							cur.ShopEvaluationRelation = cur.ShopEvaluationRelation&&cur.ShopEvaluationRelation.map(pcur=>{
								let dis = app.$vm.getDistance(Number(pcur.Shop.dimension),Number(pcur.Shop.longitude));
								pcur.distance = dis;
								return pcur;
							})
							return cur;
						});
					}else{
						this.conList = this.conList.concat(res.data.map(cur=>{
							cur.ShopEvaluationRelation = cur.ShopEvaluationRelation&&cur.ShopEvaluationRelation.map(pcur=>{
								let dis = app.$vm.getDistance(Number(pcur.Shop.dimension),Number(pcur.Shop.longitude));
								pcur.distance = dis;
								return pcur;
							})
							return cur;
						}));
					}
					this.conList = this.conList.map(cur=>{
						let obj = {};
						for(let i=0;i<cur.ShopEvaluationRelation.length;i++){
							if(i==0){
								obj = cur.ShopEvaluationRelation[i];
							}else{
								if(cur.ShopEvaluationRelation[i].distance<obj.distance){
									obj = cur.ShopEvaluationRelation[i];
								}
							}
						}
						cur.shopObj = obj;
						return cur;
					})
					if(this.page<res.data.last_page){
						this.moreFlag = true;
					}else{
						this.moreFlag = false;
					}
				})
			
			},
			//清空历史记录
			emptyhistory(){
				this.historyList = []
			},
			//清空搜索框
			emptyBtn(){
				this.searchValue = ""
			},
			//搜索
			searchBtn(){
				
				this.page = 1;
				this.conList = [];
				if(this.navIndex==0){
					this.getList();
				}else if(this.navIndex==1){
					this.getCpList();
				}else if(this.navIndex==2){
					this.getConList();
				}else if(this.navIndex==3){
					this.getList();
				}else if(this.navIndex==4){
					this.getUser();
				}
			},
			//返回
			goBack(){
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.userWrap{
		padding: 24upx;
	}
	.userItem{
		width: 100%;
		padding: 40upx;
		border-radius: 20upx;
		background: white;
		box-sizing: border-box;
		display: flex;
		margin-bottom: 16upx;
	}
	.userItem:last-child{
		margin-bottom: 0;
	}
	.imgAvator{
		width: 112upx;
		height: 112upx;
		border-radius: 50%;
		margin-right: 16upx;
		background-position: center;
		background-size: cover;
	}
	.userItemR{
		width: calc(100% - 128upx);
		height: 112upx;
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
	.userItemRT{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 30upx;
	}
	.userItemRTL{
		display: flex;
		align-items: center;
		width: 280upx;
	}
	.userItemRTL>view{
		font-size: 32upx;
		line-height: 40upx;
		font-weight: bold;
		color: #333333;
		margin-right: 10upx;
		max-width: calc(100% - 42upx);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.userItemRTL>image{
		height: 32upx;
	}
	.userItemRTR{
		font-size: 24upx;
		line-height: 24upx;
		color: #FFAC3F;
	}
	.userItemRB{
		display: flex;
		align-items: center;
	}
	.userItemRBL{
		display: flex;
		align-items: center;
		margin-right: 30upx;
	}
	.userItemRBL:last-child{
		margin-right: 0;
	}
	.userItemRBL>image{
		height: 28upx;
		margin-right: 10upx;
	}
	.userItemRBL>view{
		font-size: 20upx;
		line-height: 24upx;
		color: #333333;
	}
	.userItemRBL>view>text{
		font-size: 20upx;
		line-height: 24upx;
		color: #999999;
	}
	
	
	
	
	.foodBox {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 24upx;
	
		.foodItem {
			width: 342upx;
			background: #FFFFFF;
			opacity: 1;
			border-radius: 8upx;
			margin-bottom: 16upx;
			overflow: hidden;
	
			.foodImage {
				position: relative;
				width: 342upx;
	
				// height: 360upx;
				// border: 8upx  8upx   0 0;
				.playIcon {
					position: absolute;
					top: 20upx;
					right: 20upx;
				}
	
				/deep/.uni-video-container {
					background-color: #fff;
				}
	
				// video{
				// 	width: 100%;
				// 	height: 100%;
				// }
				// image{
				// 	width: 100%;
				// 	height: 100%;
				// }
			}
	
			.foodName {
				font-size: 24upx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #333333;
				padding: 16upx;
			}
	
			.food_B {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 16upx;
	
				.userInfo {
					display: flex;
					align-items: center;
	
					.userImage {
						width: 32upx;
						height: 32upx;
						border-radius: 50%;
						overflow: hidden;
	
						image {
							width: 100%;
							height: 100%;
							border-radius: 50%;
						}
					}
	
					.userName {
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
						margin-left: 8upx;
					}
				}
	
				.giveBox {
					display: flex;
					align-items: center;
	
					.giveNum {
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
						margin-left: 4upx;
					}
				}
			}
		}
	}
	
	
	.ProductBox{
		padding: 16upx 24upx;
		.ProductItem{
			width: 702upx;
			background: #FFFFFF;
			opacity: 1;
			border-radius: 20upx;
			padding: 24upx;
			margin-bottom: 16upx;
			.ItemTop{
				display: flex;
				border-bottom: 2upx solid #F5F5F5;
				padding-bottom: 16upx;
				.ProductImage{
					width: 144upx;
					height: 144upx;
					border-radius: 8upx;
					// background-color: #FFAC3F;
					margin-right: 24upx;
					background-size: cover;
					background-position: center;
					image{
						width: 100%;
						height: 100%;
						border-radius: 8upx;
					}
				}
				.ProductInfo{
					width: calc(100% - 168upx);
					.ProductNameBox{
						display: flex;
						align-items: center;
						justify-content: space-between;
						.ProductName{
							font-size: 24upx;
							font-family: Source Han Sans CN;
							font-weight: bold;
							color: #333333;
						}
						.sales-volume{
							font-size: 16upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #FF8255;
						}
					}
					.addressBox{
						display: flex;
						justify-content: space-between;
						align-items: center;
						margin-top: 16upx;
						.address{
							font-size: 16upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #999999;
						}
						.addressNum{
							font-size: 16upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #999999;
						}
					}
					.ranking{
						width: auto;
						// width: 130upx;
						// height: 28upx;
						background: #FFF3C8;
						opacity: 1;
						border-radius: 8upx;
						padding: 8upx;
						font-size: 12upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #683B00;
						margin-top: 12upx;
						display: inline-block;
					}
					.evaluateBox{
						display: flex;
						align-items: center;
						flex-wrap: wrap;
						margin-top: 16upx;
						.evaluateItem{
							// width: 100px;
							// height: 20px;
							background: #FFF5EA;
							opacity: 1;
							border-radius: 8upx;
							padding:4upx 8upx;
							font-size: 12upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #FFAC3F;
							margin-right: 16upx;
							margin-bottom: 16upx;
						}
					}
				}
			}
			.ItemBottom{
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				padding-top: 16upx;
				.couponBox{
					display: flex;
					align-items: center;
					margin-right: 64upx;
					margin-top: 24upx;
					.couponIcon{
						width: 28upx;
						height: 28upx;
						background: #FFAC3F;
						opacity: 1;
						border-radius: 8upx;
						text-align: center;
						line-height: 28upx;
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #FFFFFF;
					}
					.couponPrice{
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 500;
						color: #FFAC3F;
						margin-left: 8upx;
					}
					.coupontext{
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
						margin-left: 8upx;
					}
				}
				.couponBox:nth-child(2n+2){
					margin-right: 0;
				}
				.couponBox:nth-child(1){
					margin-top: 0;
				}
				.couponBox:nth-child(2){
					margin-top: 0;
				}
			}
		}
		.DiscountItem{
			width: 702upx;
			background: #FFFFFF;
			box-shadow: 0 0 12upx rgba(0, 0, 0, 0.16);
			opacity: 1;
			padding: 16upx;
			margin-bottom: 24upx;
			.Item_top{
				display: flex;
				padding-bottom: 16upx;
				border-bottom: 2upx solid #F5F5F5;
				.ItemImage{
					width: 112upx;
					height: 112upx;
					border-radius: 8upx;
					overflow: hidden;
					// background-color: #F0AD4E;
					margin-right: 16upx;
					background-position: center;
					background-size: cover;
					image{
						width: 100%;
						height: 100%;
						border-radius: 8upx;
					}
				}
				.Iteminfo{
					width: calc(100% - 128upx);
					.info_top{
						display: flex;
						justify-content: space-between;
						align-items: center;
						margin-bottom: 16upx;
						.NameBox{
							.Name{
								font-size: 20upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #333333;
								margin-bottom: 16upx;
							}
							.titmes{
								font-size: 16upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #999999;
							}
						}
						.buyBox{
							width: 96upx;
							height: 56upx;
							background: linear-gradient(180deg, #FFAC3F 0%, #FC8643 100%);
							opacity: 1;
							border-radius: 28upx;
							font-size: 24upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							line-height: 56upx;
							text-align: center;
							color: #FFFFFF;
						}
					}
					.priceBox{
						display: flex;
						justify-content: space-between;
						align-items: center;
						.price{
							font-size: 20upx;
							font-family: Source Han Sans CN;
							font-weight: bold;
							color: #FFAC3F;
						}
						.volume{
							font-size: 16upx;
							font-family: Source Han Sans CN;
							font-weight: 400;
							color: #D0D0D0;
						}
					}
				}
			}
			.Item_bottom{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 16upx 0;
				.share{
					font-size: 16upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #999999;
				}
				.surplus{
					font-size: 16upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #333333;
				}
			}
		}
	}
	.contentListWrap{
		.contentList{
			// margin-top: 24upx;
			padding: 24upx;
			.contentItem{
				width: 702upx;
				height: auto;
				background: #FFFFFF;
				opacity: 1;
				border-radius: 20upx;
				margin-bottom: 16upx;
				.contentItem_top{
					display: flex;
					padding: 32upx 0 24upx 24upx;
					.contentImage{
						width: 144upx;
						height: 144upx;
						border-radius: 8upx;
						margin-right: 16upx;
						background-position: center;
						background-size: cover;
						image{
							width: 100%;
							height: 100%;
							border-radius: 8upx;
						}
					}
					.content_R{
						width: calc(100% - 160upx);
						.contentNameBox{
							display: flex;
							align-items: center;
							justify-content: space-between;
							.contentItemName{
								font-size: 24upx;
								color: #333333;
							}
							.Royalties{
								// width: 92upx;
								// height: 32upx;
								background: linear-gradient(206deg, #FAD96C 0%, #FFAC3F 100%);
								opacity: 1;
								border-radius: 20upx 0 0 20upx;
								font-size: 16upx;
								color: #fff;
								
								padding: 8upx;
							}
						}
						.addressBox{
							display: flex;
							align-items: center;
							justify-content: space-between;
							margin-top: 8upx;
							padding-right: 24upx;
							
							.addressNum{
								display: flex;
								align-items: center;
								.address{
									// width: 300upx;
									margin-right: 10upx;
									font-size: 16upx;
									font-family: Source Han Sans CN;
									font-weight: 400;
									color: #999999;
								}
								.addressR{
									font-size: 16upx;
									font-family: Source Han Sans CN;
									font-weight: 400;
									color: #999999;
								}
							}
						}
						.fansBox{
							display: flex;
							align-items: center;
							margin-top: 8upx;
							
							.fansIcon{
								display: flex;
								justify-content: center;
								align-items: center;
								width: 48upx;
								height: 24upx;
								background: #260A20;
								opacity: 1;
								border-radius: 4upx;
								image{
									width: 24upx;
									height: 24upx;
								}
							}
							.fanstext{
								width: calc(100% - 48upx);
								font-size: 20upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #333333;
								margin-left: 8upx;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}
						.recommendBox{
							display: flex;
							align-items: center;
							margin-top: 8upx;
							.recommendtitle{
								width: 48upx;
								height: 24upx;
								background: #FFAC3F;
								opacity: 1;
								border-radius: 4upx;
								font-size: 16upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								text-align: center;
								line-height: 24upx;
								color: #FFFFFF;
								// padding: 4upx;
								// box-sizing: border-box;
								margin-right: 8upx;
							}
							.recommendtext{
								width: calc(100% - 48upx);
								font-size: 20upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #333333;
								overflow: hidden;
								text-overflow: ellipsis;
								white-space: nowrap;
							}
						}
						.fieldBox{
							display: flex;
							align-items: center;
							// margin-top: 18upx;
							.fieldtitle{
								width: 48upx;
								height: 24upx;
								background: #FF5555;
								opacity: 1;
								border-radius: 4upx;
								font-size: 16upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								line-height: 24upx;
								text-align: center;
								color: #FFFFFF;
								// padding: 4upx;
							}
							.fieldtext{
								// width: calc(100% - 48upx);
								font-size: 20upx;
								font-family: Source Han Sans CN;
								font-weight: 400;
								color: #333333;
								margin-left: 8upx;
								overflow: hidden;
								white-space: nowrap;
								text-overflow: ellipsis;
							}
						}
					}
				}
				.contentItem_B{
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 0 24upx;
					height: 44upx;
					background-color: #FFEBD0;
					border-radius: 0 0 20upx 20upx;
					box-sizing: border-box;
					.surplus{
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #999999;
						text{
							font-size: 24upx;
							color: red;
						}
					}
					.surplusNum{
						font-size: 16upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
					}
				}
			}
		}
	}
	
	
	
	.navHead{
		width: 100%;
		// margin-top: 2upx;
		padding: 32upx 24upx 16upx;
		background: white;
		display: flex;
		align-items: center;
	}
	.navItem{
		padding-bottom: 12upx;
		font-size: 24upx;
		line-height: 24upx;
		position: relative;
		margin-right: 48upx;
	}
	.navItem:last-child{
		margin-right: 0;
	}
	.navItem.active::after{
		content: "";
		width: 70%;
		height: 4upx;
		background: #FFAC3F;
		left: 50%;
		bottom: 0;
		transform: translateX(-50%);
		position: absolute;
	}
	
	
.status_bar {
	height: var(--status-bar-height);
	width: 100%;
}
.SearchPage{
	background-color: #F3F3F3;
	min-height: 100vh;
	// padding-top: 88upx;
	overflow: auto;
	.SearchPageBox{
		padding-top: 172upx;
		.top_nav_wrap{
			position: fixed;
			top: 0;
			left: 0;
			background-color: #fff;
			z-index: 9999;
			.searchBox{
				// position: fixed;
				// top: 0;
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 750upx;
				height: 88upx;
				// background-color: #fff;
				padding: 16upx 24upx;
				// z-index: 9999;
				.inputBox{
					display: flex;
					align-items: center;
					// justify-content: space-between;
					width: 534upx;
					// #ifdef MP-WEIXIN
					width: auto;
					// #endif
					height: 60upx;
					background: #F5F5F5;
					opacity: 1;
					border-radius: 34upx;
					padding: 14upx 32upx;
					input{
						width: calc(100% - 70upx);
						font-size: 24upx;
						margin-left: 8upx;
					}
					.closeBox{
						display: flex;
						justify-content: center;
						align-items: center;
						width: 24upx;
						height: 24upx;
						border-radius: 50%;
						background-color: #BFBFBF;
					}
				}
				.searchName{
					font-size: 28upx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #333333;
				}
			}
		}
		.historyBox{
			padding: 32upx 24upx;
			background-color: #fff;
			.historytitle{
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 24upx;
				.historyName{
					font-size: 24upx;
					font-family: Source Han Sans CN;
					font-weight: bold;
					color: #333333;
				}
			}
			.historyList{
				display: flex;
				align-items: center;
				flex-wrap: wrap;
				.historyItem{
					background: #F5F5F5;
					opacity: 1;
					border-radius: 8upx;
					padding: 16upx;
					margin-right: 16upx;
					margin-bottom: 24upx;
					font-size: 20upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #333333;
				}
			}
		}
		
		.emptyBox{
			display: flex;
			justify-content: center;
			align-items: center;
			width: 750upx;
			height: calc(100vh - 88upx);
			// background-color: #fff;
		}
	}
}
</style>
